#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#define int long long
using namespace std;

bool jug(const string& num)
{
	//cout << num << endl;
	if (num.size() == 0) return true;
	int l = 0, r = num.size() - 1;
	while (l < r)
	{
		if (num[l] != num[r]) return false;
		++l, --r;
	}
	if (l == r) return num[l] == '0';
	else return true;
}

void solve()
{
	int n; cin >> n;
	string num("");
	while (n)
	{
		num = to_string(n % 2) + num;
		n /= 2;
	}
	while (num.size() && num.back() == '0') num.pop_back();
	if (jug(num)) cout << "YES" << endl;
	else cout << "NO" << endl;
}

signed main()
{
	int t; cin >> t;
	while (t--) solve();
	return 0;
}

//0
//1
//1
//
//11
//10
//01
//
//0110
//1101
//1011
//
//0001000
//
//01010
//10111
//11101
//
//1011

//6 0 3 6 8 10 11